package com.classtwo.colleage.conf;

import com.classtwo.colleage.model.Student;
import com.classtwo.colleage.model.Teacher;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

/**
 * 连接Student表与数据库
 */
public interface DatabaseStudentInfo extends JpaRepository<Student,Integer>{

    // SELECT * from student WHERE username='st1' AND `password`=136500
    List<Student> findByUsernameAndPassword(String Username, String Password);

    // SELECT * from student WHERE username='st1'
    List<Student> findByUsername(String username);

    // SELECT * from student WHERE username='st1'
    Student findFirstByUsername(String username);

    // SELECT * from student WHERE username='st1' AND `name`=''
    Student findAllByNameAndUsername(String name,String username);

    // SELECT * from student WHERE studentnumber=''
    Student findFirstByStudentnumber(String studentnumber);

}
